﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "Any.h"
#include "OwnerPtr.h"
#include "GcmpJournalInterface.h"

namespace gcmp
{
    /// \brief Ui层Object数据
    ///
    /// 要求封装的数据为基类、非const object指针
    /// 比如Qt中可用此类封装的数据为非const QObject*
    class GCMP_JOURNAL_INTERFACE_EXPORT IJournalUiObject
    {
    public:
        virtual ~IJournalUiObject() {}

        static gcmp::OwnerPtr<IJournalUiObject> Create();

        /// \brief 获取Ui层Object数据
        ///
        /// 获取时设置cast类型为基类、非const object指针
        /// Qt实例：GetUiObject().cast<QObject*>();
        /// \return Ui层Object数据，实质为基类、非const object指针
        virtual gcmp::Any GetUiObject() const = 0;

        /// \brief 设置Ui层Object数据
        ///
        /// 设置前必须先转成基类非const object指针
        /// Qt实例：SetUiObject((QObject*)pObject);
        /// \param[in] object Ui层Object数据，实质为基类、非const object指针
        /// \return 运行结果，true成功，false失败
        virtual bool SetUiObejct(gcmp::Any object) = 0;
    };
}


